//
//  Extension+Label.swift
//  Weibo
//
//  Created by mac on 15/12/17.
//  Copyright © 2015年 MK. All rights reserved.
//

import UIKit

//扩展 便利函数
extension UILabel {
    
    //covenience
    convenience init(tText: String, tColor: UIColor, tFont: CGFloat, isNum: CGFloat = 0) {
        //先调用self.init()
        self.init()
        textColor = tColor
        font = UIFont.systemFontOfSize(tFont)
        numberOfLines = 0
        
        if isNum == 0 {
            text = tText + " 欢迎归来"
            textAlignment = .Center
        } else if isNum > 0 {
            text = tText
            textAlignment = .Left
            preferredMaxLayoutWidth = screenSize.width - 2 * isNum
        }
        
        sizeToFit()
    }
    
    
}
